package com.zlsy.springbootdemo.redis.bloom;

import com.google.common.hash.Funnels;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.nio.charset.Charset;

/**
 * @author zhouliang
 * @date 2021/1/26 14:27
 */
@Slf4j
@Configuration
public class BloomFilterHelperConfig {
  @Bean
  @SuppressWarnings("UnstableApiUsage")
  public BloomFilterHelper<CharSequence> bloomFilterHelper() {
    BloomFilterHelper<CharSequence> bloomFilterHelper =
        new BloomFilterHelper<>(Funnels.stringFunnel(Charset.defaultCharset()), 1000, 0.1);
    log.info("init BloomFilterHelper success:{}", bloomFilterHelper);
    return bloomFilterHelper;
  }
}
